import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      imports: ['vue', 'vue-router'],
    }),
  ],
  base: './',
  server: {
    host: true,
    port: 4006,
    proxy: {
      // https://cn.vitejs.dev/config/#server-proxy
      '/xyz': {
        target:'',
        changeOrigin: true,
        rewrite: (p) => p.replace(/^\/xyz/, ''),
        logLevel: 'debug'
      }
    }
  },
  resolve: {
    alias: {
      '~': path.resolve(__dirname, './'),
      '@': path.resolve(__dirname, './src')
    },
  },
  css: {
    preprocessorOptions: {
      scss: { api: 'modern-compiler' },
    }
  },
})
